package com.duan.laugh.rocketmq;

import com.duan.laugh.common.security.annotation.EnableLaughResourceServer;
import com.duan.laugh.starter.rocketmq.core.RocketTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;

/**
 * @author duanjw
 */
@EnableLaughResourceServer
@EnableDiscoveryClient
@SpringBootApplication
public class LaughRocketmqApplication {
    public static void main(String[] args) {
        SpringApplication.run(LaughRocketmqApplication.class,args);
    }
//    @Bean
//    public CustomRunner customRunner() {
//        return new CustomRunner();
//    }
//    public static class CustomRunner implements CommandLineRunner {
//
//        @Autowired
//        private RocketTemplate rocketTemplate;
//        @Override
//        public void run(String... args) throws Exception {
//            rocketTemplate.asyncSend("test-topic", new Message<Object>() {
//                @Override
//                public Object getPayload() {
//                    return "asdf";
//                }
//
//                @Override
//                public MessageHeaders getHeaders() {
//                    return null;
//                }
//            }, null);
//        }
//    }
}
